Skip to content

Add Terraform CI/CD workflows and MongoDB infrastructure setup#1

Merged
CloudNinjaDev merged 2 commits into
mainfrom
infra
Mar 2, 2026
Merged

Add Terraform CI/CD workflows and MongoDB infrastructure setup#1
CloudNinjaDev merged 2 commits into
mainfrom
infra

Conversation

@CloudNinjaDev
Copy link
Copy Markdown
Owner

  • Created CI workflow for Terraform to validate configurations on pull requests and pushes.
  • Added CD workflow for Terraform to manage infrastructure changes with plan, apply, and destroy jobs.
  • Defined MongoDB security group and EC2 instance resources in Terraform.
  • Included outputs for instance details and necessary variables for configuration.

- Created CI workflow for Terraform to validate configurations on pull requests and pushes.
- Added CD workflow for Terraform to manage infrastructure changes with plan, apply, and destroy jobs.
- Defined MongoDB security group and EC2 instance resources in Terraform.
- Included outputs for instance details and necessary variables for configuration.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 2, 2026

Terraform Format and Style 🖌failure

Terraform Initialization ⚙️success

Terraform Validation 🤖success

Terraform Plan 📖success

Show Plan
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # aws_instance.mongodb will be created
  + resource "aws_instance" "mongodb" {
      + ami                                  = "ami-001fbc42d7df13f78"
      + arn                                  = (known after apply)
      + associate_public_ip_address          = (known after apply)
      + availability_zone                    = (known after apply)
      + cpu_core_count                       = (known after apply)
      + cpu_threads_per_core                 = (known after apply)
      + disable_api_stop                     = (known after apply)
      + disable_api_termination              = (known after apply)
      + ebs_optimized                        = (known after apply)
      + enable_primary_ipv6                  = (known after apply)
      + get_password_data                    = false
      + host_id                              = (known after apply)
      + host_resource_group_arn              = (known after apply)
      + iam_instance_profile                 = (known after apply)
      + id                                   = (known after apply)
      + instance_initiated_shutdown_behavior = (known after apply)
      + instance_lifecycle                   = (known after apply)
      + instance_state                       = (known after apply)
      + instance_type                        = "t3.large"
      + ipv6_address_count                   = (known after apply)
      + ipv6_addresses                       = (known after apply)
      + key_name                             = "ashish-test-kp"
      + monitoring                           = (known after apply)
      + outpost_arn                          = (known after apply)
      + password_data                        = (known after apply)
      + placement_group                      = (known after apply)
      + placement_partition_number           = (known after apply)
      + primary_network_interface_id         = (known after apply)
      + private_dns                          = (known after apply)
      + private_ip                           = (known after apply)
      + public_dns                           = (known after apply)
      + public_ip                            = (known after apply)
      + secondary_private_ips                = (known after apply)
      + security_groups                      = (known after apply)
      + source_dest_check                    = true
      + spot_instance_request_id             = (known after apply)
      + subnet_id                            = (known after apply)
      + tags                                 = {
          + "Name" = "MongoDB-Instance"
        }
      + tags_all                             = {
          + "Name" = "MongoDB-Instance"
        }
      + tenancy                              = (known after apply)
      + user_data                            = (known after apply)
      + user_data_base64                     = (known after apply)
      + user_data_replace_on_change          = false
      + vpc_security_group_ids               = (known after apply)

      + root_block_device {
          + delete_on_termination = true
          + device_name           = (known after apply)
          + encrypted             = (known after apply)
          + iops                  = (known after apply)
          + kms_key_id            = (known after apply)
          + tags_all              = (known after apply)
          + throughput            = (known after apply)
          + volume_id             = (known after apply)
          + volume_size           = 8
          + volume_type           = "gp3"
        }
    }

  # aws_security_group.mongodb will be created
  + resource "aws_security_group" "mongodb" {
      + arn                    = (known after apply)
      + description            = "Security group for MongoDB EC2 instance"
      + egress                 = [
          + {
              + cidr_blocks      = [
                  + "0.0.0.0/0",
                ]
              + description      = "Allow all outbound"
              + from_port        = 0
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "-1"
              + security_groups  = []
              + self             = false
              + to_port          = 0
            },
        ]
      + id                     = (known after apply)
      + ingress                = [
          + {
              + cidr_blocks      = [
                  + "0.0.0.0/0",
                ]
              + description      = "MongoDB"
              + from_port        = 27017
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "tcp"
              + security_groups  = []
              + self             = false
              + to_port          = 27017
            },
          + {
              + cidr_blocks      = [
                  + "0.0.0.0/0",
                ]
              + description      = "SSH"
              + from_port        = 22
              + ipv6_cidr_blocks = []
              + prefix_list_ids  = []
              + protocol         = "tcp"
              + security_groups  = []
              + self             = false
              + to_port          = 22
            },
        ]
      + name                   = "mongodb-sg"
      + name_prefix            = (known after apply)
      + owner_id               = (known after apply)
      + revoke_rules_on_delete = false
      + tags                   = {
          + "Name" = "MongoDB Security Group"
        }
      + tags_all               = {
          + "Name" = "MongoDB Security Group"
        }
      + vpc_id                 = "vpc-0c4669393c94b8f86"
    }

Plan: 2 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + instance_id         = (known after apply)
  + instance_private_ip = (known after apply)
  + instance_public_ip  = (known after apply)

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "tfplan"

Pusher: @CloudNinjaDev, Action: pull_request, Workflow: Terraform CI

@CloudNinjaDev CloudNinjaDev merged commit 5313ae5 into main Mar 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant